import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
          title: const Center(
        child: Text("基础组件"),
      )),
      body: MyHomeContent(),
      floatingActionButton: FloatingActionButton(
        onPressed: () => print("FloatingActionButton"),
        child: Icon(Icons.star),
      ),
    );
  }
}

class MyHomeContent extends StatefulWidget {
  @override
  State<MyHomeContent> createState() => _MyHomeContentState();
}

class _MyHomeContentState extends State<MyHomeContent> {
  var divider = Column(
    children: const [
      Divider(
        height: 1.0,
        thickness: 1,
        color: Colors.grey,
      ),
      SizedBox(
        height: 10,
      )
    ],
  );

  @override
  Widget build(BuildContext context) {
    return ListView(
      children: [
        Row(
          children: [
            Container(
              width: 200,
              height: 200,
              color: Colors.green,
              child: Icon(Icons.pets),
              // 左上角为 (-1, -1)  中心点为 (0, 0)  右上角为 (1, 1)
              alignment: Alignment(.5, .5),
            )
          ],
        ),
        Padding(
          padding: const EdgeInsets.all(10),
          child: Text(
            "如果华佗在世，崇洋都被医治",
            style: TextStyle(fontSize: 20, backgroundColor: Colors.yellow),
          ),
        ),
        Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            Padding(
              padding: const EdgeInsets.only(left: 20),
              child: Text("外邦来学汉字，激发我民族意识",
                  style:
                      TextStyle(fontSize: 20, backgroundColor: Colors.green)),
            ),
            Padding(
                padding:
                    const EdgeInsets.symmetric(vertical: 30, horizontal: 30),
                child: Text("马钱子决明子苍耳子，还有莲子",
                    style:
                        TextStyle(fontSize: 20, backgroundColor: Colors.red))),
            Text("黄药子苦豆子川楝子，我要面子",
                style:
                    TextStyle(fontSize: 20, backgroundColor: Colors.blueGrey)),
          ],
        ),
        Row(mainAxisAlignment: MainAxisAlignment.center, children: [
          Container(
            // color: Colors.blue,
            width: 200,
            height: 200,
            transform: Matrix4.rotationZ(50),
            decoration: BoxDecoration(
                color: Colors.blue,
                border: Border.all(width: 5, color: Colors.yellowAccent),
                borderRadius: BorderRadius.circular(30),
                boxShadow: [
                  BoxShadow(
                      color: Colors.blueGrey,
                      offset: Offset(20, 20),
                      spreadRadius: 5,
                      blurRadius: 10),
                  BoxShadow(
                      color: Colors.yellow,
                      offset: Offset(-20, -20),
                      spreadRadius: 5,
                      blurRadius: 20)
                ]),
          )
        ])
      ],
    );
  }
}
